const router = require('express').Router();

const upload = require('../utils/upload');

router.post('/upload', upload.single('file'), (req, res) => {
  // req.file 就是上传文件信息
  // 地址服务器地址  /static/uploads/ filename
  console.log(req.file);
  res.send({
    code: 0,
    msg: '上传成功',
    data: {
      thumb: '/static/uploads/'+ req.file.filename
    }
  })
})  

module.exports = router;